package com.demo.house.controller;


import com.demo.house.common.Result;
import com.demo.house.entity.Answer;
import com.demo.house.service.AnswerService;
import com.demo.house.vo.request.RequestAnswerVo;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/answer/")
public class AnswerController {

    @Autowired
    private AnswerService answerService;

    /**
     * 用户新增评论
     * @param requestAnswerVo
     * @return
     */
    @PostMapping("insert")
    public Result insert(@RequestBody RequestAnswerVo requestAnswerVo){
        return Result.getSuccess().setData(answerService.insert(requestAnswerVo));
    }

    /**
     * 查询所有评论
     * @return
     */
    @GetMapping("queryAll/{id}")
    public Result list(@PathVariable Integer id){
        return Result.getSuccess().setData(answerService.list(id));
    }
}
